<?php
$baseThemeUrl = Yii::app()->theme->baseUrl;
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile($baseThemeUrl . '/js/jquery.validateAjax.js');
Util::tsRegisterAssetJs('form_wizard.js');
?>
<div class="row-fluid">

    <div id="pills" class="custom-wizard-pills">
        <ul class="nav nav-pills">
            <li id="liContacto" class="active"><a id ="act_contacto" href="#tab_contacto" data-toggle="tab">Paso 1: Datos Contacto</a></li>
            <li id='liMedio' class="disabled" ><a id ="act_medio" href="#tab_medios" data-toggle="e">Paso 2: Medios y direcciones</a></li>
        </ul>
        <div class="tab-content">
            <div class="tab-pane active" id="tab_contacto">
                <?php
                $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
                    'id' => 'contacto-form',
                    'type' => 'horizontal',
                    'enableAjaxValidation' => true,
                    'clientOptions' => array('validateOnSubmit' => true, 'validateOnChange' => false,),
                    'enableClientValidation' => false,
                ));
                ?>
                <div class="span8">
                    <div class="widget green">
                        <div class="widget-title">
                            <h4><i class="icon-briefcase"></i> <?php echo Yii::t('AweCrud.app', $model->isNewRecord ? 'Create' : 'Update') . ' ' . Contacto::label(); ?></h4>
                            <span class="tools">
                                <a href="javascript:;" class="icon-chevron-down"></a>
                                <!--a href="javascript:;" class="icon-remove"></a-->
                            </span>
                        </div>
                        <div class="widget-body">
                            <div class="row-fluid">
                                <p class="note">
                                    <?php echo Yii::t('AweCrud.app', 'Fields with') ?> <span class="required">*</span>
                                    <?php echo Yii::t('AweCrud.app', 'are required') ?>.    
                                </p>
                                <?php echo $form->dropDownList($model, 'titulo', array('Sr.' => 'Sr.', 'Srta.' => 'Srta.', 'Sra.' => 'Sra.'), array('empty' => '(Ninguno)', 'class' => 'span2 fix')) ?>

                                <?php echo $form->textField($model, 'nombre', array('maxlength' => 32, 'class' => 'span5', 'placeholder' => "Nombre")) ?>

                                <?php echo $form->textField($model, 'apellido', array('maxlength' => 32, 'class' => 'span5', 'placeholder' => "Apellido*")) ?>

                                <?php echo $form->error($model, 'apellido'); ?>

                                <?php echo $form->hiddenField($model, 'id') ?>

                                <div class="space20"></div>
                                <?php
                                $model_cuenta = Cuenta::model()->activos()->findAll();
                                if (!empty($model_cuenta)) {
                                    echo $form->select2Row($model, 'cuenta_id', array(
                                        'asDropDownList' => true,
                                        'data' => CHtml::listData(Cuenta::model()->activos()->findAll(), 'id', 'nombre'),
                                        'empty' => array(0 => '- Ninguna -'),
                                        'class' => 'span6',
                                        'options' => array(
                                            'placeholder' => 'type clever, or is, or just type!',
                                        )
                                    ));
                                }
                                ?>

                                <?php echo $form->textFieldRow($model, 'documento', array('maxlength' => 20, 'data-mask' => '0000000000', 'class' => 'span6')) ?>
                                <?php echo $form->textFieldRow($model, 'cargo', array('maxlength' => 64, 'class' => 'span6')) ?>
                                <?php echo $form->textFieldRow($model, 'departamento', array('maxlength' => 64, 'class' => 'span6')) ?>

                                <?php echo $form->textAreaRow($model, 'descripcion', array('rows' => 3, 'class' => 'span10')) ?>

                                <!--</div>-->

                                <div class="form-actions">
                                    <div class="form-actions-float">
                                        <?php
                                        $this->widget('bootstrap.widgets.TbButton', array(
//                                        'buttonType' => 'submit',
                                            'type' => 'success',
                                            'icon' => 'ok',
                                            'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
                                            'htmlOptions' => array(
                                                'onClick' => 'js:save("#contacto-form")')
                                        ));
                                        ?>
                                        <?php
                                        $this->widget('bootstrap.widgets.TbButton', array(
                                            'icon' => 'remove',
                                            'label' => Yii::t('AweCrud.app', 'Cancel'),
                                            'htmlOptions' => array('onclick' => 'javascript:history.go(-1)')
                                        ));
                                        ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="span4">
                    <?php if ($grupos): ?>
                        <div class="widget green">
                            <div class="widget-title">
                                <h4><i class="icon-archive"></i> Grupos</h4>
                                <span class="tools">
                                    <a href="javascript:;" class="icon-chevron-down"></a>
                                    <!--a href="javascript:;" class="icon-remove"></a-->
                                </span>
                            </div>
                            <div class="widget-body">
                                <div class="check-box-list">
                                    <?php echo $form->checkBoxList($model, 'grupos', CHtml::listData($grupos, 'id', 'nombre'), array_map('AweHtml::getPrimaryKey', $model->grupos)); ?>
                                </div>
                            </div>
                        </div>
                    <?php endif; ?>

                    <div class="widget">
                        <div class="widget-title">
                            <h4><i class="icon-lock"></i> Permisos</h4>
                            <span class="tools">
                                <a href="javascript:;" class="icon-chevron-down"></a>
                                <!--a href="javascript:;" class="icon-remove"></a-->
                            </span>
                        </div>
                        <div class="widget-body permisos">
                            <?php echo $form->dropDownListRow($model, 'owner_id', CHtml::listData(Yii::app()->user->um->listUsers(), 'iduser', 'username'), array('empty' => '- Seleccione -', 'class' => 'span12 fix')) ?>
                            <div class="radio-list">
                                <?php echo $form->radioButtonListRow($model, 'permisos', $model->permisosOpciones) ?>
                            </div>
                        </div>
                    </div>
                </div>

                <?php $this->endWidget(); ?>
            </div>
            <div class="tab-pane" id="tab_medios">
                <div class="row-fluid">
                    <div class="offset10">
                        <a id="btn_finalizar" class="btn  btn-info" type="button"> Finalizar </a>
                    </div>
                    <div class="space15"></div>
                </div>
                <div class="row-fluid">
                    <?php $this->renderPartial('steps/_direccionContactos', array('model' => $model)) ?>
                </div>
                <div class="row-fluid">
                    <div class="span6">
                        <?php $this->renderPartial('steps/_emailContactos', array('model' => $model)) ?>
                    </div>
                    <div class="span6">
                        <?php $this->renderPartial('steps/_telefonoContactos', array('model' => $model)) ?>
                    </div> 
                </div>
                <div class="row-fluid">
                    <div class="span6">
                        <?php $this->renderPartial('steps/_redesSociales', array('model' => $model)) ?>
                    </div>
                </div>
                <div class="row-fluid">
                </div>
            </div>
        </div>
    </div>
</div>
